public class util {
    public static int binarySqrt(int number) {


        if (number == 0 || number == 1) {


            return number;


        }


        int start = 1, end = number, result = 0;


        while (start <= end) {


            int mid = (start + end) / 2;


            if (mid * mid == number) {


                return mid;


            }


            if (mid * mid < number) {


                start = mid + 1;


                result = mid;


            } else {


                end = mid - 1;


            }


        }

        return result;
    }
}
